<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body>div{
            width: 200px;

            border: 1px solid red;
            /*当元素所有的子元素全部浮动时  自动识别的高度为0
            后面的元素会顶上来导致显示异常，添加overflow:hidden 解决此异常*/
            overflow: hidden;
        }
        #d1{
            width: 50px;
            height: 50px;
            background-color: red;
            float: left;
        }
        #d2{
            width: 50px;
            height: 50px;
            background-color: green;
            float: left;
        }
        #d3{
            width: 50px;
            height: 50px;
            background-color: yellow;
            float: left;
        }
    </style>
</head>
<body>
<div>
    <div id="d1">div1</div>
    <div id="d2">div2</div>
    <div id="d3">div3</div>
</div>

</body>
</html>